package com.xbongbong.paas.pojo.dto;

import com.xbongbong.paas.enums.DelEnum;
import com.xbongbong.paas.enums.MenuTypeEnum;
import com.xbongbong.paas.toolbox.wrap.BaseDTO;
import com.xbongbong.paas.toolbox.wrap.QueryIgnore;
import com.xbongbong.pro.enums.AccessLinkEnum;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * @author: wufeng
 * @date: 2018/8/7 19:47
 * @desrcption: 新建菜单表单
 */
@Setter
@Getter
@ToString
public class MenuFormAddDTO extends BaseDTO {

    private static final long serialVersionUID = -1073231930280340759L;
    /**
     * 应用id
     */
    @NotNull(message = "{dto.msg.menuFormAdd.appId.NotNull}")
    private Long appId;

    /**
     * 分组名称
     */
    @NotBlank(message = "{dto.msg.menuFormAdd.name.NotBlank}")
    @Length(max = 20, message = "{dto.msg.menuFormCopy.name.Length}")
    @Getter(onMethod_ = {@QueryIgnore})
    private String name;

    /**
     * 分组名称英文版
     */
    @NotBlank(message = "{dto.msg.menuFormAdd.name.NotBlank}")
    @Length(max = 50, message = "{dto.msg.menuFormAdd.name.Length}")
    @Getter(onMethod_ = {@QueryIgnore})
    private String nameEn;

    /**
     * 分组类型 1 分组，2 表单，3 表单(开启流程)，4 统计，5：非表单菜单
     * @see MenuTypeEnum
     */
    @NotNull(message = "{dto.msg.menuFormAdd.type.NotNull}")
    @Getter(onMethod_ = {@QueryIgnore})
    private Integer type;

    /**
     * 应用图标
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private String icon;

    /**
     * 颜色，16进制色，如 FF0000
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private String color;


    /**
     * 父类id
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private Long parentId;

    /**
     * saas和paas
     * @see com.xbongbong.pro.enums.SaasMarkEnum
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private Integer saasMark;
    /**
     * 业务标识
     * @see com.xbongbong.saas.enums.XbbRefTypeEnum
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private Integer businessType;

    /**
     * 排序
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private Integer sort;

    /**
     * 业务标识
     * @see com.xbongbong.saas.enums.XbbRefTypeEnum
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private String alias;

    /**
     * 访问链接
     * @see com.xbongbong.pro.enums.AccessLinkEnum
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private String url;
    /**
     * 手机端访问地址
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private String mobileUrl;
    /**
     * 是否启用 1：启用，0：不启用
     */
    private Integer enable;

    private Integer del;

    private Integer distributorMark;

    public MenuFormAddDTO() {
        super();
        //默认前端传过来的应用为自建应用
        parentId = 0L;
        name = "未命名表单";
        type = MenuTypeEnum.FORM.getType();
        businessType = 0;
        icon = AccessLinkEnum.PAAS_LIST.getIcon();
        color = AccessLinkEnum.PAAS_LIST.getColor();
        alias = "";
        url = AccessLinkEnum.PAAS_LIST.getUrl();
        mobileUrl = AccessLinkEnum.PAAS_LIST.getMobileUrl();
        del = DelEnum.NORMAL.getDel();
        enable = 1;
        distributorMark = 0;
    }
}
